
import React from 'react';
import { Modal } from 'antd';
import ProForm, {  ProFormText,  ProFormSelect} from '@ant-design/pro-form';
import orderproductCreate from '../../func/productorder_create';
import productaddList from '../../func/productadd_list';

interface AddorderproductFormProps {
  modalVisible: boolean;
  orderkey:any;
  onCancel: () => void;
}

const AddorderproductForm: React.FC<AddorderproductFormProps> = (props) => {
  const request = async () => {
    return await productaddList({})
  };

  return (
    <Modal
      destroyOnClose
      title={"编辑用户"}
      visible={props.modalVisible}
      onCancel={() => props.onCancel()}
      onOk={() => props.onCancel()}
    >
      <ProForm
        onFinish={async (values) => {
          values["order_key"]=props.orderkey;
          orderproductCreate(values);
        }}
      >
       <ProFormSelect
            width="md"
            name="product_number"
            label="品号"
            fieldProps={{
              labelInValue: true,
            }}
            request={request}
          />
       <ProFormText
            width="md"
            name="product_sum"
            label="数量"
          />
      </ProForm>
    </Modal>
  );
};

export default AddorderproductForm;
